﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title>
    <link href="../../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
    <link href="../../../lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" /> 
    <script src="../../../lib/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/ligerui.all.js"></script>
    <script src="../../grid/CustomersData.js"></script>
    <script type="text/javascript"> 
        var groupicon = "../../../lib/ligerUI/skins/icons/communication.gif";
        var form = null;
        $(function ()
        { 
            //创建表单结构 
            form = $("#form2").ligerForm({
                inputWidth: 170, labelWidth: 90, space: 40,
                fields: [
                {
                    display: "类别 ", name: "CategoryID", newline: true, type: "select", dictionary: '001|002|003|004',
                    afterContent: '<div style="margin-right:10px;margin-left:6px;color:red;float:left;">采用了dictionary属性</div>'
                },
                { display: "类别2 ", name: "CategoryID", newline: false, type: "radiolist", dictionary: '001|002|003|004', editor: { rowSize: 7 } },
                { display: "日期 ", name: "AddTime", newline: true, type: "date" },
                { display: "折扣", name: "QuantityPerUnit", newline: true, type: "number", editor: { onChangeValue: sum } },
                {
                    display: "单价", name: "UnitPrice", newline: false, type: "number", editor: { onChangeValue: sum },
                    afterContent: '<div style="margin-right:10px;margin-left:6px;color:red;float:left;">这里设置了联动计算效果</div>'
                },
                {
                    display: "结算", name: "RealPrice", newline: true, type: "digits", groupicon: groupicon,
                    afterContent: '<div style="margin-right:10px;margin-left:6px;color:red;float:left;">结算=单价*折扣/100</div>'
                }
                ]
            });
        });

        function sum()
        {
            var data = form.getData(); 
            $("[name=RealPrice]").val(data.QuantityPerUnit * data.UnitPrice / 100);
        }
    </script> 

</head>
<body style="padding:10px"> 
  <div id="form2"></div> 
</html>